  
******************************************************************************************************
******************************************************************************************************
**-----------------------------In the Shadows of Great Men: ----------------------------------------**
**-----------Retired Leaders and Informal Power Constraints in Autocracies -------------------------**
**------------------------  BRITICH JOURNAL OF POLITICAL SCIENCE------------------------------------**
******************************************************************************************************
******************************************************************************************************


** Author: Junyan Jiang, Tianyang Xi, and Haojun Xie
** Last Updated: Nov 19, 2023
** Environment: 
*** Stata 18 MP
*** Windows 11 Pro 64-bit.
*** 16GB RAM





**************************************************************************
**************************************************************************
***********************	ANALYSIS	**************************************
**************************************************************************
**************************************************************************
use replication_data_country_year, replace

******************************************************* 
*************** Table 1. Baseline *********************
*******************************************************

xi i.year i.ld2 

xtset cowcode year
eststo clear
// Ngram //
local var rpbook_noc
eststo m1: reg    `var'    l(1/3).`var'   log_maxOfallprepower    if  main_samp ==1 ,   ///
 cluster(cowcode)   
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var'    log_maxOfallprepower      if  main_samp ==1   , ///
a(year regime2) cluster(cowcode) keepsing
estadd local rfe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"


local var   rpbook_noc 
eststo m3: reghdfe     `var'    l(1/3).`var'   log_maxOfallprepower       if  main_samp==1   , ///
a(year ld2  ) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"


local var rpbook_noc  
eststo m4: reghdfe      `var'    l(1/3).`var'  log_maxOfallprepower     length_ce2   loggdp_v2 logpop_v2   if  main_samp==1  , ///
a(year ld2   ) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

local var rpbook_noc
eststo m5: xtabond2 `var' l(1/3).`var' length_ce2 loggdp_v2 logpop_v2 log_maxOfallprepower  _I*  if main_samp==1  ,  gmmstyle(`var', laglimits(2 .)) ///
gmmstyle(log_maxOfallprepower, laglimits(2 .)) ivstyle(_I*   , p) noleveleq robust nodiffsargan cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)" 
estadd scalar nc=`e(N_g)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"



esttab m*  using out.txt,   nonote nobaselevels keep(log_maxOfallprepower  ) b(3) se(3) ///
order(log_maxOfallprepower ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("OLS" "OLS" "OLS" "OLS" "GMM" ) mgroup("Incumbent personal power (Ngram)", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag rfe fe cov nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Regime and year fixed effects" "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0  0 0 0 0) )





******************************************************************
*************** Table 2. Cumulative Effects **********************
******************************************************************


// Obtain sample mean
reghdfe   rpbook_noc   l(1/3).rpbook_noc length_ce2   loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1   , ///
a(year ld2) cluster(cowcode)

sum log_maxOfallprepower if e(sample) & any_maxOfallprepower==1
local mu=`r(mean)'

/// Compute cumulative effect ///
local vars rpbook_noc    
forv i=1/1{
local dv: word `i' of `vars'

reghdfe    `dv'    l(1/3).`dv' length_ce2   loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1   , ///
a(year ld2) cluster(cowcode)


sum `dv' if e(sample)
local ysd=`r(sd)'

global limit=10
nlcom (shortrun: _b[log_maxOfallprepower]*`mu') ///
 (lag1: _b[L1.`dv']) ///
 (lag2: _b[L2.`dv'])  ///
 (lag3: _b[L3.`dv'])  ///
 (lag4: 0), post

global limit=10
vareffects 

nlcom (immediate:_b[shortrun]/`ysd') ///
	(year5:_b[effect5]/`ysd') ///
	(year10:_b[effect10]/`ysd') ///
	(max:_b[longrun]/`ysd'), post
	
eststo mef`i'
}


esttab me* using out.txt ,   nonote noobs b(5) se(3) ///
star(* 0.1 ** 0.05 *** 0.01) varlabel(immediate "Immediate predecessor effect" year5 "Cumulative effect: 5 years" year10 "Cumulative effect: 10 years" max "Cumulative effect: maximum") booktabs replace   ///
nomtitles mgroup("Incumbent power (Ngram)", pattern(1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) 





*********************************************************
*************** Figure 3. Parallel Trends ***************
*********************************************************

local var  rpbook_noc
reghdfe   `var'     l*rpbook_noc     pre2 pre1     turnover_within   post1   post2 post3            if  main_samp==1   , a(year ld2) cluster(cowcode) 
margins, dydx(         pre2  pre1      turnover_within      post1   post2        post3            )
marginsplot
expmat parallel 



*********************************************************
*************** Table 3. Mechanism **********************
*********************************************************


*** Subcomponents of Personalism (GWF) ****
eststo clear

local var partyexcom_pers
eststo m1: reghdfe     F.D.`var'   length_ce2  loggdp_v2 logpop_v2  log_maxOfallprepower       if  main_samp==1    , ///
a(year  ld2 ) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var milmerit_pers 
eststo m2: reghdfe     F.D.`var'    length_ce2    loggdp_v2 logpop_v2 log_maxOfallprepower     if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var milnotrial
eststo m3: reghdfe     F.D.`var'     length_ce    loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1     , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


local var sectyapp_pers
eststo m4: reghdfe   F.D.`var'   length_ce   loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1   , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



local var inst_exe2
eststo m6: reghdfe    F.D.`var'    length_ce  loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1    , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var inst_leg2
eststo m7: reghdfe    F.D.`var'     length_ce  loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1   , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


local var inst_party2
eststo m8: reghdfe    F.D.`var'    length_ce  loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1    , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


esttab m*  using out.txt,  beta  nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
order(log_maxOfallprepower) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles( "Incumbent ruler controls appointments to party executive committee"  "Incumbent ruler promotes military loyal to him/her personally" "Incumbent ruler imprisons/kills officers" "Incumbent ruler personally controls security apparatus"     "Competitive executive selection"  "Competitive legislative selection" "Multi-party competition") ///
mgroup("Aspects of personalism" "Attributes of institutions", pattern(1   0 0  0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(yr  nc N, labels("Leader and year fixed effects"    "\# of countries"    "Observations") fmt(0   0 0) )






****************************************************************
*************** Table 4. Cabinet Analysis **********************
****************************************************************

use replication_data_cabinet, clear

eststo clear

eststo m1: reghdfe  current_share    log_maxOfallprepower   loggdp_v2 logpop_v2  cabsize   if   main_samp==1  & nomiss==1  , a(cen year) cluster(cowcode) keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"

eststo m2: reghdfe current_share   log_maxOfallprepower   rpbook_noc     loggdp_v2 logpop_v2   cabsize   if   main_samp==1 , a(cen year) cluster(cowcode) keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"

eststo m3: reghdfe logavgbook_currentappoint2  log_maxOfallprepower    loggdp_v2 logpop_v2  cabsize   if   main_samp==1 & nomiss==1  , a(cen year) cluster(cowcode) keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"

eststo m4: reghdfe logavgbook_currentappoint2      log_maxOfallprepower    rpbook_noc   loggdp_v2 logpop_v2   cabsize   if   main_samp==1    , a(cen year) cluster(cowcode)  keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"

eststo m5: reghdfe  logavgbook_formerappoint2     log_maxOfallprepower     loggdp_v2 logpop_v2   cabsize if   main_samp==1 & nomiss==1  , a(cen year) cluster(cowcode) keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"

eststo m6: reghdfe  logavgbook_formerappoint2     log_maxOfallprepower      rpbook_noc  loggdp_v2 logpop_v2  cabsize   if   main_samp==1   , a(cen year) cluster(cowcode) keepsing
estadd local ife "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local cov "\(\checkmark\)"



esttab m*  using out.txt,   nonote nobaselevels keep(log_maxOfallprepower   rpbook_noc) b(3) se(3) ///
order(log_maxOfallprepower     rpbook_noc) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("Share of incumbent's appointees" "Average Ngram of incumbents' appointees" "Average Ngram of predecessors' appointees", pattern(1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(cov   ife  nc N, labels("Control variables"  "Leader and year fixed effects"  "\# of countries"    "Observations") fmt(0 0 0 0 ) )



***************************************************************************************************************************************
**************************************************** Robustness Checks in Appendix ****************************************************
***************************************************************************************************************************************

use replication_data_country_year, replace


********************************************************************
***************** Table A.1. Summary Statistics  *******************
********************************************************************


global cov  rpbook_noc rp_noc rpbook_noc_ml  ///
log_comp90th log_comp10rank  length_ce2   ///
log_maxOfallprepower  any_maxOfallprepower   ///
log_maxOfallprepower_dpr5 log_maxOfallprepower_dpr10 log_maxOfallprepower_dpr20 ///
log_maxOfallprepower_current log_maxOfallprepower_ml ///
log_dead_pred log_maxOfallprepower_placebo ///
loggdp_v2 logpop_v2  english ///
t1_personalism xhatmean gwf_party2 gwf_military2 gwf_personal2    ///
partyexcom_pers milmerit_pers milnotrial sectyapp_pers ///
inst_exe2 inst_leg2 inst_party2  

eststo summ: estpost summarize $cov  if  main_samp==1

esttab summ using out.txt, booktabs ///
nomtitle nonumber noobs cells("mean(fmt(a2)) sd(fmt(a2)) min max count") replace label




********************************************************************
***************** Table A.8. Correlation between Ngram and GWF *****
********************************************************************


eststo clear
eststo m6: reghdfe t1_personalism   f2_rpbook_noc f1_rpbook_noc rpbook_noc l1_rpbook_noc l2_rpbook_noc ,  cluster(cowcode) a(cowcode year)
capture drop tp1_s
g tp1_s=e(sample)

eststo m1: reghdfe t1_personalism  f2_rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m2: reghdfe t1_personalism  f1_rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m3: reghdfe t1_personalism rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m4: reghdfe t1_personalism  l1_rpbook_noc if tp1_s==1, cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m5: reghdfe t1_personalism l2_rpbook_noc if tp1_s==1 , cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

capture drop tp1_s

esttab m1 m2 m3 m4 m5 m6  using out.txt, beta nonote nobaselevels keep(f2_rpbook_noc f1_rpbook_noc rpbook_noc l1_rpbook_noc l2_rpbook_noc  )  b(3) se(3) ///
 star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Personalism index (GWF)", pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(cfe r2_a   N, labels("Country and year fixed effects"   "Adjusted R\(^2\)"    "Observations") fmt(0  2   0) )




******************************************************************************
***************** Table A.9. Correlation between Gandhi and Sumner ***********
******************************************************************************

eststo clear
eststo m6: reghdfe xhatmean   f2_rpbook_noc f1_rpbook_noc rpbook_noc l1_rpbook_noc l2_rpbook_noc ,  cluster(cowcode) a(cowcode year)
capture drop tp1_s
g tp1_s=e(sample)

eststo m1: reghdfe xhatmean  f2_rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m2: reghdfe xhatmean  f1_rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m3: reghdfe xhatmean rpbook_noc if tp1_s==1,  cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m4: reghdfe xhatmean  l1_rpbook_noc if tp1_s==1, cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

eststo m5: reghdfe xhatmean l2_rpbook_noc if tp1_s==1 , cluster(cowcode) a(cowcode year)
estadd local cfe "\(\checkmark\)"

capture drop tp1_s

esttab m1 m2 m3 m4 m5 m6  using out.txt, beta nonote nobaselevels keep(f2_rpbook_noc f1_rpbook_noc rpbook_noc l1_rpbook_noc l2_rpbook_noc  )  b(3) se(3) ///
 star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Power consolidation index (GS)", pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(cfe r2_a   N, labels("Country and year fixed effects"   "Adjusted R\(^2\)"    "Observations") fmt(0  2   0) )



*************************************************************************************
**************** Tables A.10 & A.11. Top 10 vs. Bottom 10 Predecessors **************
*************************************************************************************

preserve
g ct=1
keep if main_samp==1
collapse (mean) log_maxOfallprepower      max_premean_r_mean      (first) countryn   max_premean_r_cen, by(max_premean_r_Id)

gsort -max_premean_r_mean
br

restore

*************************************************************************************************
************ Table A.12. Correlating Power Index with Tenure Length and Coup Risk ***************
************************************************************************************************* 

// Overall tenure length //
preserve
collapse (max) length_ce   (mean) rpbook_noc  (first) cowcode year if main_samp ==1,by(ld2)
eststo m1: reghdfe length_ce rpbook_noc, a(cowcode   )
estadd local fe "\(\checkmark\)"
restore



// Coup risk //
eststo m2: reghdfe coup1 rpbook_noc     if main_samp ==1, a(cowcode year)
estadd local fe "\(\checkmark\)"
estadd local yfe "\(\checkmark\)"

// export estimated relationship with concrete outcomes //
esttab m1 m2    using out.txt, nonote nobaselevels keep(rpbook_noc) b(3) se(3) ///
star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("Tenure Length" "Coup", pattern(1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(    fe  yfe N, labels(    "Country fixed effects" "Year fixed effects" "\# of countries"    "Observations") fmt(0   0 0) )


// Computing effect size //

// average living predecessor: .8695737 (sum log_maxOfallprepower if main_samp ==1 & any_maxOfallprepower==1)
// sd of rpbook_noc: 1.389 (sum rpbook_noc if main_samp ==1)
// cumulative effect size for the presence of an average living predecessor: -0.247 

//** presence of an average predecessor on tenure length
di -0.247 * 1.389 *  2.101   // --> -0.72 years in tenure length

//** presence of an average predecessor 
di -0.247 * 1.389  *  -.0239703 // --> + 0.008 in coup risk
di -0.247 * 1.389  *  -.0239703/.0521826   // --> + 15.8% in coup risk


//** average to Julius Nyerere (2.0822) (sum log_maxOfallprepower if max_premean_c_cen=="Julius Nyerere")
// cumulative effect (compared to no predecessor): - 0.562 (run the cumulative effect script with mu = 2.0822)

di -(0.562-0.247) * 1.389  *  2.101   // moving from average to Nyerere =  -0.919 years  reduction in tenure length
di -(0.562-0.247) * 1.389  *   -.0239703  // moving from average to Nyerere =  +0.01  in coup risk
di -(0.562-0.247) * 1.389  *   -.0239703/.0521826  // ~ 20% increase from the baseline



******************************************************* 
*********** Table A.13. By GWF regime types ***********
******************************************************* 
xtset cowcode year

local var rpbook_noc
eststo m1: reghdfe    `var'    l(1/3).`var'   length_ce   loggdp_v2 logpop_v2  c.log_maxOfallprepower     if main_samp ==1  & gwf_party2==1 , a(year ld2) cluster(cowcode)  keepsingle
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
unique gwf_spell if   e(sample)


local var rpbook_noc 
eststo m2: reghdfe    `var'      l(1/3).`var'  length_ce2   loggdp_v2 logpop_v2  log_maxOfallprepower    if main_samp ==1  & gwf_military2==1 , a(year ld2) cluster(cowcode)  keepsingle
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
unique gwf_spell if   e(sample)

local var rpbook_noc 
eststo m3: reghdfe    `var'      l(1/3).`var'  length_ce2 loggdp_v2 logpop_v2  log_maxOfallprepower      if main_samp ==1  & gwf_personal2==1 , a(year ld2) cluster(cowcode)  keepsingle
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
unique gwf_spell if   e(sample)



esttab m1 m2 m3    using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("Party" "Military" "Personalist"  ) mgroup("Incumbent power (Ngram)", pattern(1 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag   fe   nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"   "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0    0 0) )



/// For Figure 4 ///
mat D=J(3,3,99)
mat colnames D=beta lb90 ub90
forv i=1/3{
estimate restore m`i'
mat D[`i',1]=_b[log_maxOfallprepower]
mat D[`i',2]=_b[log_maxOfallprepower]-1.64*_se[log_maxOfallprepower]
mat D[`i',3]=_b[log_maxOfallprepower]+1.64*_se[log_maxOfallprepower]
}

capture drop beta lb90 ub90
svmat D, names(col)
outsheet beta lb90 ub90 using sub_coef.csv, replace comma
capture drop beta lb90 ub90



*******************************************************************
*************** Table A.14. Multiple Language *********************
*******************************************************************
xi i.year i.ld2

xtset cowcode year
eststo clear
// Ngram //
local var rpbook_noc_ml
eststo m1: reg    `var'    l(1/3).`var'  log_maxOfallprepower_ml      if  main_samp==1   , ///
 cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



local var rpbook_noc_ml
eststo m2: reghdfe    `var'    l(1/3).`var'  log_maxOfallprepower_ml      if  main_samp==1   , ///
a(year regime2) cluster(cowcode) keepsing
estadd local rfe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"

local var rpbook_noc_ml
eststo m3: reghdfe    `var'    l(1/3).`var'  log_maxOfallprepower_ml       if  main_samp==1   , ///
a(year regime2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"



local var rpbook_noc_ml
eststo m4: reghdfe    `var'    l(1/3).`var' length_ce2  loggdp_v2 logpop_v2 log_maxOfallprepower_ml       if  main_samp==1    , ///
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

local var rpbook_noc_ml
eststo m5: xtabond2 `var' l(1/3).`var' length_ce2 loggdp_v2 logpop_v2 log_maxOfallprepower_ml  _I*  if main_samp==1  ,  gmmstyle(`var', laglimits(2 .)) ///
gmmstyle(log_maxOfallprepower_ml, laglimits(2 .)) ivstyle(_I*   , p) noleveleq robust nodiffsargan cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_g)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"




esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower_ml) b(3) se(3) ///
 star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("OLS" "OLS" "OLS" "OLS" "GMM" ) mgroup("Incumbent power (multi-language Ngram)", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag rfe fe  cov nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Regime and year fixed effects" "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0  0 0 0 0) )




******************************************************************************* 
************ Table A.15. Subsample by Official Language = English *************
*******************************************************************************
eststo clear

// English as official language //

local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var' length_ce2    loggdp_v2 logpop_v2 log_maxOfallprepower    if  main_samp==1 & english==1, ///
a(year ld2) cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

// Official language is not English //

local var rpbook_noc 
eststo m3: reghdfe    `var'    l(1/3).`var' length_ce2    loggdp_v2 logpop_v2 log_maxOfallprepower       if  main_samp==1 & english==0, ///
a(year ld2) cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
order(log_maxOfallprepower) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup(  "Official language \(=\) English" "Official language \(\neq\) English", pattern(  1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag fe   nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0 0 0) )





**********************************************************************************
*************** Table A.16. Alternative Dependent Variables **********************
**********************************************************************************

eststo clear


local var rp_noc
eststo m1: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var log_comp_pred
eststo m2: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var log_comp90th
eststo m3: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var log_comp10rank
eststo m4: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2  log_maxOfallprepower      if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'




esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower ) b(3) se(3) ///
order(log_maxOfallprepower ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("Power index based on \# of mentions" "Incumbent's Ngram relative to the most powerful living predecessor" "Incumbent's Ngram relative to the 90th percentile" "Incumbent's Ngram relative to the 10th highest", pattern(1 1 1 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag fe   nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)" "Year and leader fixed effects" "\# of countries"    "Observations") fmt(0 0 0 0) )





*********************************************************************************************
************************ Table A.17. Effect on Overall Tenure Length ************************
*********************************************************************************************

//// Shorter tenure ////
preserve
collapse (first) regime2 any_pred_r log_maxOfallprepower    cowcode no_pred*_r edu_ceyear     loggdp_v2 logpop_v2  cen_age ///
(max) length_ce2 length_ce      (min) year (mean)  rpbook_noc       if auto_samp==1 ,by(ld2)
eststo clear
label var edu_ceyear "Year of education"
//label var exp_ce_militaryyear "Year of military experience"
label var cen_age "Age"
label var no_pred_r "\# of living predecessors"
//label var no_predless80_r "\# of living predecessors under 80 at entry year"
//label var gwf_party "Party-based (GWF)"
//label var gwf_military "Military (GWF)" 
//label var gwf_personal "Personalistic (GWF)"
//label var ea "Electoral autocracy"
//label var share_with_pred "Share of tenure under one or more predecessor"
label var any_pred_r "Any living predecessor (1=yes)"
label var log_maxOfallprepower "Predecessor power"
label var loggdp_v2 "Log GDP per capita"
label var logpop_v2 "Log population"

eststo clear
eststo m1: reg length_ce2   i.cowcode  log_maxOfallprepower ,robust cluster(cowcode)
estadd local ct "\(\checkmark\)"

eststo m2: reg length_ce2   i.regime2   log_maxOfallprepower ,robust cluster(cowcode)
estadd local reg "\(\checkmark\)"

eststo m3: reg length_ce2   i.regime2  edu_ceyear   cen_age log_maxOfallprepower  ,robust cluster(cowcode)
estadd local reg "\(\checkmark\)"

eststo m4: reg length_ce2   i.regime2 edu_ceyear   cen_age any_pred_r ,robust cluster(cowcode)
estadd local reg "\(\checkmark\)"


eststo m5: reg length_ce2   i.regime2   edu_ceyear   cen_age no_pred_r ,robust cluster(cowcode)
estadd local reg "\(\checkmark\)"


esttab   m1 m2 m3 m4 m5 using out.txt, nonote nobaselevels drop(*cons *cowcode *regime2  )  b(3) se(3) ///
order(log_maxOfallprepower  any_pred_r    no_pred_r  cen_age   edu_ceyear   ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Incumbent's total tenure length", pattern(1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(  ct reg r2   N, labels("Country fixed effects"  "Regime fixed effects" "R\(^2\)"    "Observations") fmt(   0 0 2   0) )

restore

************************************************************************
************* Table A.18. Using GWF Personalism as DV ******************
************************************************************************
eststo clear
xi i.year i.ld2
xtset cowcode year
// Personalism //
local var   t1_personalism
eststo m1: reg    `var'       log_maxOfallprepower   if  main_samp==1  , ///
 cluster(cowcode)  
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var  t1_personalism
eststo m2: reghdfe    `var'  L(1/3).`var'    log_maxOfallprepower      if main_samp==1  , ///
a(year regime2) cluster(cowcode) keepsing
estadd local rfe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"


local var  t1_personalism
eststo m3: reghdfe   `var' l(1/3).`var'    log_maxOfallprepower           if main_samp==1  , ///
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"

local var  t1_personalism
eststo m4: reghdfe    `var' l(1/3).`var' length_ce2   loggdp_v2 logpop_v2   log_maxOfallprepower      if  main_samp==1    , ///
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"


local var t1_personalism
eststo m5: xtabond2 `var' l(1/3).`var' length_ce2 loggdp_v2 logpop_v2 log_maxOfallprepower  _I*  if main_samp==1  ,  gmmstyle(`var', laglimits(2 .)) ///
gmmstyle(log_maxOfallprepower, laglimits(2 .)) ivstyle(_I*   , p) noleveleq robust nodiffsargan cluster(cowcode)

estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_g)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles("OLS" "OLS" "OLS" "OLS" "GMM" ) mgroup("DV: Personalism index (GWF)", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag rfe fe  cov  nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Regime and year fixed effects" "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0  0 0 0 ) )



******************************************************************************************************
************* Table A.19. Using Gandhi and Sumner's Power Consolidation Index as DV ******************
******************************************************************************************************



// GS power consolidation //
eststo clear
local var   xhatmean
eststo m1: reg    `var'    l(1/3).`var'     log_maxOfallprepower   if  main_samp==1  , ///
 cluster(cowcode)  
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


local var  xhatmean
eststo m2: reghdfe    `var'    l(1/3).`var'    log_maxOfallprepower      if main_samp==1  , ///
a(year regime2) cluster(cowcode) keepsing
estadd local rfe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"

local var  xhatmean
eststo m3: reghdfe    `var'    l(1/3).`var'   log_maxOfallprepower      if main_samp==1  , ///
a(year regime2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"



local var  xhatmean
eststo m4: reghdfe    `var'   l(1/3).`var'    length_ce2   loggdp_v2 logpop_v2   log_maxOfallprepower      if  main_samp==1    , ///
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

local var xhatmean
eststo m5: xtabond2 `var' l(1/3).`var' length_ce loggdp_v2 logpop_v2  log_maxOfallprepower  _I*  if main_samp==1   ,  gmmstyle(`var', laglimits(2 .)) ///
gmmstyle(log_maxOfallprepower, laglimits(2 .)) ivstyle(_I*   , p) noleveleq robust nodiffsargan cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_g)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"


esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
 star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
mtitles("OLS" "OLS" "OLS" "OLS" "GMM" ) mgroup("DV: Power consolidation index (GS)", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag rfe fe  cov nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Regime and year fixed effects" "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0 0 0 0 0) )





**************************************************************************************** 
***************** Table A.20. Alterantive Measures of Predecessors' Power **************
****************************************************************************************

eststo clear 

/////////// median power ///////////////
local var rpbook_noc
eststo m1: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2 log_maxOfallprepower_median      if  main_samp==1   , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

/////////// binary presence ///////////////
local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var' length_ce2 loggdp_v2 logpop_v2 any_maxOfallprepower      if  main_samp==1  , ///
a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


esttab m1 m2    using out.txt, nonote nobaselevels keep(log_maxOfallprepower_median   any_maxOfallprepower  ) b(3) se(3) ///
order(log_maxOfallprepower_median   any_maxOfallprepower  ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Incumbent personal power (Ngram)" , pattern(1 0 0   ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(  yr ld nc N, labels("Lagged DV \((t-1,t-2,t-3)\)" "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0  0 0) )




****************************************************************************** 
*************** Table A.21. Allow Predecessor Power to Change ****************
******************************************************************************
eststo clear
// Exponential decacy //
local var rpbook_noc 
eststo m1: reghdfe    `var'    l(1/3).`var' length_ce   loggdp_v2 logpop_v2    log_maxOfallprepower_dpr5       if  main_samp==1  , a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var rpbook_noc 
eststo m2: reghdfe    `var'    l(1/3).`var' length_ce   loggdp_v2 logpop_v2    log_maxOfallprepower_dpr10       if  main_samp==1  , a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


local var rpbook_noc 
eststo m3: reghdfe    `var'    l(1/3).`var' length_ce   loggdp_v2 logpop_v2     log_maxOfallprepower_dpr20        if  main_samp==1 ,a(year ld2) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

// Just use most powerful predecessor's current power ///
local var rpbook_noc 
eststo m4: reghdfe    `var'    l(1/3).`var' length_ce  loggdp_v2 logpop_v2    log_maxOfallprepower_current    if  main_samp==1  , a(year ld2 ) cluster(cowcode)
estadd local yr "\(\checkmark\)"
estadd local ld "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

esttab m1 m2 m3 m4    using out.txt, nonote nobaselevels keep(log_maxOfallprepower_dpr* log_maxOfallprepower_current) b(3) se(3) ///
 star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Incumbent personal power (Ngram)" , pattern(1 0 0 0  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(  yr ld nc N, labels("Lagged DV \((t-1,t-2,t-3)\)" "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0  0 0) )




*******************************************************************
*********** Table A.22. Using GWF Regime Sample *******************
*******************************************************************
xi i.year i.ld2

xtset cowcode year
eststo clear
// Ngram //
local var rpbook_noc
eststo m1: reg    `var'    l(1/3).`var'  log_maxOfallprepower      if  gwf_autocracy==1 & founding2==0 , ///
 cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var'  log_maxOfallprepower      if  gwf_autocracy==1 & founding2==0, ///
a(year regime2) cluster(cowcode) keepsing
estadd local rfe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"

local var rpbook_noc
eststo m3: reghdfe    `var'    l(1/3).`var'  log_maxOfallprepower      if gwf_autocracy==1  & founding2==0, ///
a(year regime2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"


local var rpbook_noc
eststo m4: reghdfe    `var'    l(1/3).`var' length_ce2  loggdp_v2 logpop_v2 log_maxOfallprepower      if gwf_autocracy==1& founding2==0  , ///
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

local var rpbook_noc 
eststo m5: xtabond2 `var' l(1/3).`var' length_ce loggdp_v2 logpop_v2 log_maxOfallprepower   _I* if gwf_autocracy==1 & founding2==0,  gmmstyle(`var', laglimits(2 .)) ///
gmmstyle(log_maxOfallprepower , laglimits(2 .)) ivstyle(_I*   , p) noleveleq robust nodiffsargan cluster(cowcode)
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_g)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"




esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
 star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("OLS" "OLS" "OLS" "OLS" "GMM" ) mgroup("Incumbent power (Ngram)", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag rfe fe  cov nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"  "Regime and year fixed effects" "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0 0 0 0 0) )



*********************************************************************************
***************** Table A.23. Modes of Change in Predecessor Power **************
*********************************************************************************
///////// Natural Death ///////////////
eststo clear
local var rpbook_noc 
eststo m1: reghdfe    `var'   l(1/3).`var'  length_ce2   loggdp_v2 logpop_v2 log_maxOfallprepower     if main_samp==1  & natural_death==1 , a(year ld2) cluster(cowcode)   
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

///////// To No Predecessor ///////////////
local var rpbook_noc 
eststo m2: reghdfe    `var'   l(1/3).`var'  length_ce2   loggdp_v2 logpop_v2 log_maxOfallprepower     if main_samp==1  & any_toweak==0 , a(year ld2) cluster(cowcode)   
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

///////// To Weak Predecessor ///////////////
local var rpbook_noc 
eststo m3: reghdfe    `var'   l(1/3).`var'  length_ce2   loggdp_v2 logpop_v2 log_maxOfallprepower     if main_samp==1  & any_tozero==0 , a(year ld2) cluster(cowcode)   
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



esttab m1 m2 m3  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("Natural death" "To no predecessor only" "To a weaker predecessor"  ) mgroup("Incumbent power (Ngram)", pattern(1 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag   fe   nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"   "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0    0 0) )




****************************************************************
************ Table A.24. Remove Influential Observations *******
****************************************************************
xi i.year i.ld2 

local var rpbook_noc
reghdfe    `var'    l(1/3).`var' length_ce     loggdp_v2 logpop_v2 log_maxOfallprepower    if  main_samp==1,a(year ld2) cluster(cowcode) keepsingle
g regsamp = e(sample)

local var rpbook_noc
eststo m4: reg    `var'    l(1/3).`var'   loggdp_v2 logpop_v2 log_maxOfallprepower    _I*    if  main_samp==1   
predict ckd, cooksd
sum ckd if  regsamp==1   ,d

* p95:  .0049308  
* p90:  .0019541
* p75:  .0005367   
g samp_cook75 = main_samp==1 & ckd<`r(p75)'
g samp_cook90 = main_samp==1 & ckd<`r(p90)'
g samp_cook95 = main_samp==1 & ckd<`r(p95)'

// export results //
eststo clear
local var rpbook_noc
eststo m1: reghdfe    `var'    l(1/3).`var' length_ce     loggdp_v2 logpop_v2 log_maxOfallprepower       if  samp_cook95==1   , /// remove > 95% pct outlier
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"


local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var' length_ce     loggdp_v2 logpop_v2 log_maxOfallprepower        if samp_cook90==1, /// remove > 90% pct outlier
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

local var rpbook_noc
eststo m3: reghdfe    `var'    l(1/3).`var' length_ce     loggdp_v2 logpop_v2 log_maxOfallprepower        if samp_cook75==1    , /// remove > 75% pct outlier
a(year ld2) cluster(cowcode) keepsing
estadd local fe "\(\checkmark\)"
estadd local lag "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'
estadd local yr "\(\checkmark\)"
estadd local cov "\(\checkmark\)"




esttab m*  using out.txt,   nonote nobaselevels keep(log_maxOfallprepower   ) b(3) se(3) ///
order(log_maxOfallprepower ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("Remove Cook's Distance $\geqslant$ 95 percentile"  "Remove Cook's Distance $\geqslant$ 90 percentile" "Remove Cook's Distance $\geqslant$ 75 percentile") mgroup("Incumbent personal power (Ngram)", pattern(1 0 0  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag   fe cov nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)"   "Leader and year fixed effects" "Control variables" "\# of countries"    "Observations") fmt(0 0  0 0 0 0) )





****************************************************************
*************** Table A.25. Placebo Tests **********************
****************************************************************

eststo clear

xtset cowcode year
local var rpbook_noc 
eststo m1: reghdfe    `var'    l(1/3).`var'   loggdp_v2 logpop_v2  length_ce2 log_dead_pred      ///
 if  main_samp==1    , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var rpbook_noc
eststo m2: reghdfe    `var'    l(1/3).`var'   loggdp_v2 logpop_v2 length_ce2    log_maxOfallprepower_placebo   ///
 if  main_samp==1    , ///
a(year ld2) cluster(cowcode)
estadd local lag "\(\checkmark\)"
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'



esttab m1 m2  using out.txt, nonote nobaselevels keep( log_dead_pred log_maxOfallprepower_placebo  ) b(3) se(3) ///
order( log_dead_pred log_maxOfallprepower_placebo  ) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Incumbent power (Ngram)" , pattern(1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(lag fe   nc N, labels( "Lagged DV \((t-1,t-2,t-3)\)" "Leader and year fixed effects" "\# of countries"    "Observations") fmt(0 0 0 0) )



************************************************************************************** 
**************** Table A.26. Predecessor Exit Mode and Antecedant Power **************
**************************************************************************************

//// predecessor power --> consensual exit  ////
xtset spell_id spell_time

eststo clear
eststo m1: reghdfe   cons_exit  c.rpbook_noc  c.length_ce2##c.length_ce2##c.length_ce2     if auto_samp==1   , a(regime2 year) cluster(ld2) // powerful leaders are slightly more likely to exit peacefully
estadd local fe "\(\checkmark\)"
estadd local spline "\(\checkmark\)"

eststo m2: reghdfe  cons_exit        rpbook_noc  c.length_ce2##c.length_ce2##c.length_ce2  loggdp_v2 logpop_v2     founding2     if auto_samp==1  , a(regime2 year) cluster(ld2) // powerful leaders are slightly more likely to exit peacefully
estadd local fe "\(\checkmark\)"
estadd local spline "\(\checkmark\)"
estadd local cov "\(\checkmark\)"

esttab m*  using out.txt,   nonote nobaselevels keep(rpbook_noc   ) b(3) se(3) ///
order( rpbook_noc) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: pre-mortem consensual exit (1=yes)", pattern(1 0  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(fe spline cov N, labels( "Regime and year fixed effects" "Tenure cubic spline "  "Control variables" "\# of countries"    "Observations") fmt(0 0  0 0  ) )




*****************************************************************
*************** Table A.27. Selection Model *********************
*****************************************************************

xtset cowcode year
eststo m1: heckman rpbook_noc  l(1/3).rpbook_noc    log_maxOfallprepower2  loggdp_v2 logpop_v2 i.ld2       if main_samp==1, select(pred_consensualx2 =         log_imm_prepower2 regime2_duration loggdp_v2 logpop_v2  i.regime2)    twostep   
  

esttab m1 using out.txt, nonote nobaselevels nomtitles b(3) se(3)  booktabs replace star(* 0.1 ** 0.05 *** 0.01) drop(  *ld2 L*noc _cons *regime2  ) label eqlabel("Main" "Selection") mgroup("Incumbent power (Ngram)", pattern(1 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) stats(    N, labels(     "Observations") fmt(    0) )



*******************************************************************************************************************
*********** Table A.28. Deliberate Selection of Weaker Successors? No Evidence for non-Founders *******************
*******************************************************************************************************************
eststo clear
local var log_cen_btenure_1
eststo m1: reghdfe    `var'     loggdp_v2 logpop_v2  log_maxOfallprepower    if  main_samp==1 &    is_cen_firstyear==1   , a(year   regime2 ) cluster(cowcode) keepsingle
estadd local fe "\(\checkmark\)"
estadd local cov "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var log_cen_btenure_2
eststo m2: reghdfe    `var'    loggdp_v2 logpop_v2 log_maxOfallprepower   if  main_samp==1 &     is_cen_firstyear==1   , a(year  regime2   ) cluster(cowcode) keepsingle
estadd local fe "\(\checkmark\)"
estadd local cov "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

local var log_cen_btenure_3
eststo m3: reghdfe    `var'    loggdp_v2 logpop_v2 log_maxOfallprepower   if  main_samp==1 &     is_cen_firstyear==1  , a(year   regime2  ) cluster(cowcode) keepsingle
estadd local fe "\(\checkmark\)"
estadd local cov "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'


esttab m*  using out.txt, nonote nobaselevels keep(log_maxOfallprepower) b(3) se(3) ///
order(log_maxOfallprepower) star(* 0.1 ** 0.05 *** 0.01) label booktabs replace   ///
mtitles("\(X=1\)" "\(X=2\)" "\(X=3\)") mgroup("Power index of incumbent \textbf{\emph{X}} year(s) before entering office" , pattern(1 0   0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats( cov fe   nc N, labels( "Control variables" "Regime and year fixed effects" "\# of countries"    "Observations") fmt(0 0 0 0) )






*******************************************************************
*************** Table A.29. Control for Country Mentions **********************
*******************************************************************
eststo m1: reghdfe rpbook_noc log_bm_country  if  main_samp==1, a(cowcode year) cluster(cowcode) keepsingle
estadd local fe "\(\checkmark\)"
estadd scalar nc=`e(N_clust)'

esttab m1 using out.txt, nonote nobaselevels keep(log_bm_country) b(3) se(3) ///
order(log_bm_country) star(+ 0.1 * 0.05 ** 0.01) label booktabs replace   ///
nomtitles mgroup("DV: Incumbent power" , pattern(1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
stats(  fe   nc N, labels(   "Country and year fixed effects" "\# of countries"    "Observations") fmt(0 0  0) )




